/*
 * Copyright ©2015-2021 Jaemon. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gitee.jaemon.spring.adorner.demo.controller;

import io.gitee.jaemon.spring.adorner.annotation.ApiNote;
import io.gitee.jaemon.spring.adorner.demo.entity.QueryDTO;
import io.gitee.jaemon.spring.adorner.demo.entity.RequestDTO;
import io.gitee.jaemon.spring.adorner.demo.entity.Response;
import io.gitee.jaemon.spring.adorner.demo.entity.UserDTO;
import io.gitee.jaemon.spring.adorner.extend.Note;
import org.springframework.web.bind.annotation.*;

/**
 * 用户接口
 *
 * @author Jaemon
 * @since 1.0
 */
@RestController
@RequestMapping("/user")
public class UserController {

    /**
     * 创建用户(javadoc)
     *
     * @param user
     * @return
     */
    @Note("创建用户(注解注释)")
    @PostMapping("/createUser")
    public Response createUser(@RequestBody UserDTO user) {

        return Response.success(user);
    }

    /**
     * 创建用户
     *
     * @param requestDTO
     * @return
     */
    @PostMapping("/create")
    public Response create(@RequestBody RequestDTO<QueryDTO> requestDTO) {

        return Response.success(requestDTO);
    }

    /**
     * 删除用户
     *
     * @param id
     * @return
     */
    @PostMapping("/delete/{id}")
    @ApiNote("删除用户接口")
    public Response delete(@PathVariable("id") Long id) {

        return Response.success(id);
    }

    /**
     * 修改用户
     *
     * @param requestDTO
     * @return
     */
    @PostMapping("/modify")
    public Response modify(@RequestBody RequestDTO<QueryDTO> requestDTO) {

        return Response.success(requestDTO);
    }

    /**
     * 查询用户
     *
     * @param requestDTO
     * @return
     */
    @PostMapping("/query")
    public Response query(@RequestBody RequestDTO<QueryDTO> requestDTO) {

        return Response.success(requestDTO);
    }
}